import React, { createRef } from 'react'

function CustomTextInput(props: any) {
    return (
        <div>
            <input type="text" ref={props.inputRef} />
        </div>
    )
}

class Parent extends React.Component {
    inputElement: any = createRef()
    componentDidMount() {
        console.log(this.inputElement, 'ref---')
        this.inputElement.focus()
    }
    render() {
        return (
            <CustomTextInput inputRef={(el: any) => this.inputElement = el} />
        )
    }
}

export default Parent